package com.program.houai.job;

import com.program.houai.entity.OrderRoyaltyEntity;
import com.program.houai.redis.RedisLock;
import com.program.houai.service.IOrderRoyaltyService;
import com.program.houai.service.IUserService;
import com.program.houai.util.DateFullUtils;
import com.program.houai.vo.UserOrderVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * @version v1.0
 * @ProjectName: hou
 * @ClassName: ScheduledTasks
 * @Description: TODO(一句话描述该类的功能)
 * @Author: Topcheer
 * @Date: 2024/9/4 20:40
 */
@Component
@Slf4j
public class ScheduledTasks {



    @Autowired
    private IOrderRoyaltyService orderRoyaltyService;

    /**
    *@description:  每天晚上11点（即23点0分0秒）
    *@author: 王涛
    * @date: 2024/9/4 22:15
     * @param
    * @return: void
    * @throws:
     */
    //@Scheduled(cron = "0 0/30 * * * ?")
    @Scheduled(fixedRate = 5000)
    public void saveRoyaltyOrder() {
        orderRoyaltyService.saveRoyaltyOrder();
    }

    /**
    *@description:  每35分钟计算佣金
    *@author: 王涛 
    * @date: 2024/9/5 21:29
     * @param 
    * @return: void
    * @throws: 
     */
    @Scheduled(fixedRate = 15000)
    //@Scheduled(cron = "0 0/35 * * * ?")
    public void saveUserRoyalty() {
        orderRoyaltyService.saveUserOrderRoyalty();
    }

    //@Scheduled(cron = "0 0/30 * * * ?")
    @Scheduled(fixedRate = 5000)
    public void updateUserOrder() {
        orderRoyaltyService.updateUserOrder();
    }
}
